<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
<head>
<title>邮件列表 -- </title>
<base href="<%=basePath%>" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="i/buyu.ico">
<link rel="apple-touch-icon-precomposed" href="i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
<link rel="stylesheet" href="layui/css/layui.css">


<style type="text/css">
.waterTable tr td {
	background: #f3f4f6;
}

.water-field {
	font-size: 16px;
	font-weight: bold;
}

.info-field {
	border-bottom: 0;
}

.edit-field {
	display: none;
}

.tpl-block {
	font-size: 14px;
}
</style>
</head>
<%
	String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
%>
<body>
<br/>
			<div class="tpl-block">
				<div class="am-g" style="margin-bottom: 10px;">
					<div class="am-u-sm-12 am-u-md-12"></div>
				</div>
				<div>
					<div id="EmailInfoShow">
						<table class="layui-table" id="datagrid" lay-filter="datagrid"></table>
					</div>
				</div>
			</div>
			<div class="tpl-alert"></div>


	<script src="js/jquery.min.js"></script>
    <script src ="layui/layui.js"></script>
    
    <script>
    	layui.use(['layer','table'],function(){
    		var layer = layui.layer;
    		var table  = layui.table;
    		
    		table.render({
    			elem : '#datagrid',
    			url : 'email/list',
    			method : 'post',
    			title : '邮件列表',
    			totalRow : true,
    			cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
				id:'allAttTable',
				request:{
					pageName:'PageIndex',
					limitName:'PageCount'
				},
				cols : [ [ 
					{
						field : 'title',
					    title : '标题'
					},{
						field : 'annex',
						title : '附件'
					},{
						field : 'receivedId',
						title : '收件人'
					},{
						field : 'opertTime',
						title : '操作时间'
					},{
						field : 'opertAdmin',
						title : '操作人'
					} ] ],
					page : true,
					response : {
						statusCode : 200
					},
					parseData : function(res){
						return {
							"code" : res.status, //解析接口状态
							"msg" : res.message, //解析提示文本
							"count" : res.count, //解析数据长度
							"data" : res.data //解析数据列表
						//解析数据列表
						};
					}
    		});
    		
    		setInterval(function(){
              	table.reload('allAttTable', {
              		page:{
              			curr:1
              		}
              	});
              },60000);
    	});
    	
    	
    	/* var datasource=$("#datagrid").attr("datasource");
    	$.ajax({
    		type:"POST",
    		url:datasource,
    		saync:true,
    		success:function(resp){
    			resp = JSON.parse(resp);
    			//console.log(resp);取到了值
    			$("#EmailInfoShow").addClass("active");//给加样式的作用
    			var ht = '';
		        for(var i = 0;i < resp.length; i++){
		        	if (resp[i].id == '') {
		        		resp[i].id = '无';
		        	}
		        	if (resp[i].title == '') {
		        		resp[i].title = '无';
		        	}
		        	if (resp[i].annex == '') {
		        		resp[i].annex = '无';
		        	}
		        	
		        	if (resp[i].receivedId == '') {
                        resp[i].receivedId = '无';
                    }
                    if (resp[i].opertTime == '') {
                        resp[i].opertTime = '无';
                    }
                    if (resp[i].opertAdmin == '') {
                        resp[i].opertAdmin = '无';
                    }
                    ht = ht + '<tr>';
                    ht = ht + '<td>' + resp[i].id + '</td>';
                    ht = ht + '<td>' + resp[i].title + '</td>';
                    ht = ht + '<td>' + resp[i].annex + '</td>';
                    ht = ht + '<td>' + resp[i].receivedId + '</td>';
                    ht = ht + '<td>' + resp[i].opertTime + '</td>';
                    ht = ht + '<td>' + resp[i].opertAdmin + '</td>';
                    ht = ht + '</tr>';
                }
                $("#tbody-result").html(ht);
    		},
    		error:function(){
    			
    		}
    	}); */
    </script>

</body>

</html>